package com.niit.web.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.niit.bean.QuesReply;
import com.niit.service.QuesReplyService;
import com.niit.service.impl.QuesReplyServiceImpl;
import com.niit.utils.WebKit;

@WebServlet("/AddQuesReplyController")
public class AddQuesReplyController extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		QuesReply qr = WebKit.request2Bean(request, QuesReply.class);
		QuesReplyService qrs = new QuesReplyServiceImpl();
		qrs.add(qr);
		
		request.getRequestDispatcher("/ShowQuestionViewController?id="+qr.getQuesId()).forward(request, response);
	}
	
	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doGet(request, response);
	}

}
